package com.qfedu.mapper;

import com.qfedu.model.Developer;
import com.qfedu.model.Developer;
import com.qfedu.page.PageResult;
import com.qfedu.page.QueryPageBean;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * @author LiJH
 * @date 2023-02-10
 */
public interface DeveloperMapper {
    @Select("select count(*) from developer where status=1")
    Long count();

    @Select("select * from developer where status=1 limit #{currentPage},#{pageSize}")
    List<Developer> findPage(@Param("currentPage")Integer currentPage, @Param("pageSize") Integer pageSize);

    @Select("select * from developer where status = 1 and did= #{did}")
    Developer findDeveByDid(String did);
    @Select("select dname from developer where status = 1 and did= #{did}")
    String findByDid(String did);

    @Insert("insert into developer values(#{did},#{dname},#{updatetime}) ")
    int addDeveloper(Developer developer);

    @Update("update developer set did=#{did},dname={dname},updatetime=#{updatetime} where did=#{did}")
    int editDeveloper(Developer developer);

    //删除
    @Update("update developer set status=0 where did = #{did}")
    int deleteByDid(String did);

}